package com.newegg.sshd.command;

import com.beust.jcommander.Parameter;
import com.newegg.sshd.AbstractCommand;

public class Df extends AbstractCommand{
	
	@Parameter(names = {"-h", "--human-readable"}, description = "print sizes in human readable format (e.g., 1K 234M 2G)")
    boolean h = true;

	public String help() {
		return "Usage: df [OPTION]... [FILE]...\r\n" + 
				"Show information about the file system on which each FILE resides,\r\n" + 
				"or all file systems by default.\r\n" + 
				"\r\n" + 
				"Mandatory arguments to long options are mandatory for short options too.\r\n" + 
				"  -a, --all             include pseudo, duplicate, inaccessible file systems\r\n" + 
				"  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,\r\n" + 
				"                           '-BM' prints sizes in units of 1,048,576 bytes;\r\n" + 
				"                           see SIZE format below\r\n" + 
				"      --direct          show statistics for a file instead of mount point\r\n" + 
				"      --total           produce a grand total\r\n" + 
				"  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)\r\n" + 
				"  -H, --si              likewise, but use powers of 1000 not 1024\r\n" + 
				"  -i, --inodes          list inode information instead of block usage\r\n" + 
				"  -k                    like --block-size=1K\r\n" + 
				"  -l, --local           limit listing to local file systems\r\n" + 
				"      --no-sync         do not invoke sync before getting usage info (default)\r\n" + 
				"      --output[=FIELD_LIST]  use the output format defined by FIELD_LIST,\r\n" + 
				"                               or print all fields if FIELD_LIST is omitted.\r\n" + 
				"  -P, --portability     use the POSIX output format\r\n" + 
				"      --sync            invoke sync before getting usage info\r\n" + 
				"  -t, --type=TYPE       limit listing to file systems of type TYPE\r\n" + 
				"  -T, --print-type      print file system type\r\n" + 
				"  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE\r\n" + 
				"  -v                    (ignored)\r\n" + 
				"      --help     display this help and exit\r\n" + 
				"      --version  output version information and exit\r\n" + 
				"\r\n" + 
				"Display values are in units of the first available SIZE from --block-size,\r\n" + 
				"and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.\r\n" + 
				"Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).\r\n" + 
				"\r\n" + 
				"SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units\r\n" + 
				"are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).\r\n" + 
				"\r\n" + 
				"FIELD_LIST is a comma-separated list of columns to be included.  Valid\r\n" + 
				"field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',\r\n" + 
				"'size', 'used', 'avail', 'pcent', 'file' and 'target' (see info page).\r\n" + 
				"\r\n" + 
				"GNU coreutils online help: <http://www.gnu.org/software/coreutils/>\r\n" + 
				"For complete documentation, run: info coreutils 'df invocation'\r\n" + 
				"";
	}
	
	@Override
	public String run() {
		if(h) {
			return "/dev/mapper/vg_centos-lv_root   92G   31G   61G  34% /\r\n" + 
					"devtmpfs                       3.8G     0  3.8G   0% /dev\r\n" + 
					"tmpfs                          3.9G   12K  3.9G   1% /dev/shm\r\n" + 
					"tmpfs                          3.9G  349M  3.5G   9% /run\r\n" + 
					"tmpfs                          3.9G     0  3.9G   0% /sys/fs/cgroup\r\n" + 
					"/dev/sda1                      509M  180M  330M  36% /boot\r\n" + 
					"tmpfs                          781M     0  781M   0% /run/user/914910250\r\n" + 
					"";
		}
		return "Filesystem                    1K-blocks     Used Available Use% Mounted on\r\n" + 
				"/dev/mapper/vg_centos-lv_root  95893764 32383324  63510440  34% /\r\n" + 
				"devtmpfs                        3983236        0   3983236   0% /dev\r\n" + 
				"tmpfs                           3995140       12   3995128   1% /dev/shm\r\n" + 
				"tmpfs                           3995140   356440   3638700   9% /run\r\n" + 
				"tmpfs                           3995140        0   3995140   0% /sys/fs/cgroup\r\n" + 
				"/dev/sda1                        520868   183468    337400  36% /boot\r\n" + 
				"tmpfs                            799032        0    799032   0% /run/user/914910250\r\n" + 
				"";
	}
}
